package com.wudl.sparksql

import org.apache.spark.sql.SparkSession

object DfDemo {

  def main(args: Array[String]): Unit = {
    val spark: SparkSession = SparkSession.builder().appName("DF").master("local[2]")
      .getOrCreate()
    val df = spark.read.json("C:\\Users\\Administrator\\Desktop\\json\\people.json")
    df.createTempView("tmp")
    spark.sql(
      """
        |select
        |name,age
        |from tmp
        |""".stripMargin
    ).show()

    df.show()
    spark.stop()


  }


}
